package com.zuxia.action;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.zuxia.entity.Posit;
import com.zuxia.service.IPositService;

@Controller()
@Scope("prototype")
@ParentPackage("json-default")
@Namespace("/")
@Results({
	@Result(name="ps",type="json")
})
public class PositAction extends ActionSupport implements ModelDriven<Posit>{

	private Posit posit;
	@Override
	public Posit getModel() {
		// TODO Auto-generated method stub
		return posit;
	}
	
	@Autowired
	private IPositService poservice;
	
	private List<Posit> list;
	
	
	public List<Posit> getList() {
		return list;
	}

	public void setList(List<Posit> list) {
		this.list = list;
	}

	public Posit getPosit() {
		return posit;
	}

	public void setPosit(Posit posit) {
		this.posit = posit;
	}

	public IPositService getPoservice() {
		return poservice;
	}

	public void setPoservice(IPositService poservice) {
		this.poservice = poservice;
	}
	
	@Action("findPosit")
	public String findPosit() {
		list = poservice.selectPosit();
		ActionContext.getContext().getValueStack().push(list);//ѹջ
		return "ps";
		
	}

}
